<?php

namespace System\Core;

use \System\Types;

/**
 * Description of Controller
 *
 * @author elton.schivei
 */
abstract class Controller extends Engineer
{

    const RENDERMODE = "";

    /**
     * @var \System\Lib\MasterPage
     */
    protected $masterPage = null;
    protected static $_instance;

    public function disableMasterPage()
    {
        $this->masterPage->Disable();
    }

    public function enableMasterPage()
    {
        $this->masterPage->Enable();
    }

    public static function getMode()
    {

    }

    function __construct()
    {
        parent::__construct();
        self::$_instance = $this;
        $this->log->WriteLog('Controller Class Initialized', \System\Lib\Log::DEBUG);
    }

    /**
     * @return Controller
     */
    public static function &GetInstance()
    {
        if (!self::$_instance)
            self::$_instance = new self();

        return self::$_instance;
    }

    /**
     * @access private
     */
    public function render()
    {
        if ($this->masterPage && !$this->masterPage->Disabled())
            $this->masterPage->Dispose();
    }

}
